package com.zr.eim.service.impl;

import com.zr.common.utils.DateUtils;
import com.zr.eim.domain.EimAnalysisScreen;
import com.zr.eim.domain.EimDataCloseContactInfo;
import com.zr.eim.mapper.EimDataCloseContactInfoMapper;
import com.zr.eim.service.IEimDataCloseContactInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 密接信息Service业务层处理
 * 
 * @author peihang
 * @date 2022-10-21
 */
@Service
public class EimDataCloseContactInfoServiceImpl implements IEimDataCloseContactInfoService 
{
    @Autowired
    private EimDataCloseContactInfoMapper eimDataCloseContactInfoMapper;

    /**
     * 查询密接信息
     * 
     * @param id 密接信息主键
     * @return 密接信息
     */
    @Override
    public EimDataCloseContactInfo selectEimDataCloseContactInfoById(Long id)
    {
        return eimDataCloseContactInfoMapper.selectEimDataCloseContactInfoById(id);
    }

    /**
     * 查询密接信息列表
     * 
     * @param eimDataCloseContactInfo 密接信息
     * @return 密接信息
     */
    @Override
    public List<EimDataCloseContactInfo> selectEimDataCloseContactInfoList(EimDataCloseContactInfo eimDataCloseContactInfo)
    {
        return eimDataCloseContactInfoMapper.selectEimDataCloseContactInfoList(eimDataCloseContactInfo);
    }

    /**
     * 新增密接信息
     * 
     * @param eimDataCloseContactInfo 密接信息
     * @return 结果
     */
    @Override
    public int insertEimDataCloseContactInfo(EimDataCloseContactInfo eimDataCloseContactInfo)
    {
        eimDataCloseContactInfo.setCreateTime(DateUtils.getNowDate());
        return eimDataCloseContactInfoMapper.insertEimDataCloseContactInfo(eimDataCloseContactInfo);
    }

    /**
     * 修改密接信息
     * 
     * @param eimDataCloseContactInfo 密接信息
     * @return 结果
     */
    @Override
    public int updateEimDataCloseContactInfo(EimDataCloseContactInfo eimDataCloseContactInfo)
    {
        return eimDataCloseContactInfoMapper.updateEimDataCloseContactInfo(eimDataCloseContactInfo);
    }

    /**
     * 批量删除密接信息
     * 
     * @param ids 需要删除的密接信息主键
     * @return 结果
     */
    @Override
    public int deleteEimDataCloseContactInfoByIds(Long[] ids)
    {
        return eimDataCloseContactInfoMapper.deleteEimDataCloseContactInfoByIds(ids);
    }

    /**
     * 删除密接信息信息
     * 
     * @param id 密接信息主键
     * @return 结果
     */
    @Override
    public int deleteEimDataCloseContactInfoById(Long id)
    {
        return eimDataCloseContactInfoMapper.deleteEimDataCloseContactInfoById(id);
    }

    @Override
    public void addCloseContactInfo(EimDataCloseContactInfo eimDataCloseContactInfo) {

        eimDataCloseContactInfoMapper.insertEimDataCloseContactInfo(eimDataCloseContactInfo);
    }

    /**
     * 查询当前密接人数
     * 需求模块：数据大屏
     */
    @Override
    public int getCurrentNum(){
        return eimDataCloseContactInfoMapper.getCurrentNum();
    }

    /**
     * 查询近七日密接人数
     * 需求模块：数据大屏
     */
    @Override
    public List<EimAnalysisScreen> getCloseContactNumAndDate(){
        return eimDataCloseContactInfoMapper.getCloseContactNumAndDate();
    }
}
